git push error 'remote rejected] master -> master (branch is currently checked out)'

Posted by hap497 on Stack Overflow See other posts from Stack Overflow or by hap497
Published on 2010-05-12T06:06:36Z Indexed on 2010/05/12 6:14 UTC
Read the original article Hit count: 545

Filed under:

Hi,

Yesterday, I post a question regarding how to clone a git repository from 1 of my machine to another. http://stackoverflow.com/questions/2808177/how-can-i-git-clone-from-another-machine/2809612#2809612

I am able to successfully clone a git repository from my src (192.168.1.2) to my dest (192.168.1.1).

But when I did an edit to a file and then do a 'git commit -a -m "test"' and then do a git push.

I get this error on my dest (192.168.1.1):

git push                                                
[email protected]'s password: 
Counting objects: 21, done.
Compressing objects: 100% (11/11), done.
Writing objects: 100% (11/11), 1010 bytes, done.
Total 11 (delta 9), reused 0 (delta 0)
error: refusing to update checked out branch: refs/heads/master
error: By default, updating the current branch in a non-bare repository
error: is denied, because it will make the index and work tree inconsistent
error: with what you pushed, and will require 'git reset --hard' to match
error: the work tree to HEAD.
error: 
error: You can set 'receive.denyCurrentBranch' configuration variable to
error: 'ignore' or 'warn' in the remote repository to allow pushing into
error: its current branch; however, this is not recommended unless you
error: arranged to update its work tree to match what you pushed in some
error: other way.
error: 
error: To squelch this message and still keep the default behaviour, set
error: 'receive.denyCurrentBranch' configuration variable to 'refuse'.
To git+ssh://[email protected]/media/LINUXDATA/working
! [remote rejected] master -> master (branch is currently checked out)
error: failed to push some refs to 'git+ssh://[email protected]/media/LINUXDATA/working'

I have 2 version of git, will that causes this problem?

I have git 1.7 on 192.168.1.2 (src) but git 1.5 on 192.168.1.1 (dest).

I appreciate if someone can help me with this.

Thank you.

© Stack Overflow or respective owner

Related posts about git